package com.znyj.servlet.service;

import com.znyj.servlet.dao.FactoryDao;
import com.znyj.servlet.entity.FactoryEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by gaoliwei02 on 17/7/31.
 */
@Service
public class FactoryService {

    @Autowired
    private FactoryDao factoryDao;

    public int updateReborn(String reborn, String deviceId){
        return factoryDao.updateReborn(reborn, deviceId);
    }

    public int insertFactory(FactoryEntity factoryEntity) {
        return factoryDao.insert(factoryEntity);
    }

    public int updateFactory(FactoryEntity factoryEntity) {
        return factoryDao.update(factoryEntity);
    }

    public FactoryEntity findByImei(String imei) {
        return factoryDao.findByImei(imei);
    }

    public int countByImei(String imei) {
        return factoryDao.countByImei(imei);
    }

    public int deleteByImei(String imei) {
        return factoryDao.deleteByImei(imei);
    }

    public boolean isExistImei(String imei) {
        if (factoryDao.isExistImei(imei) == 1)
            return true;
        else
            return false;
    }

    public int countByExp(String exp){
        return factoryDao.countByExp(exp);
    }
}
